package com.example.skinmanager.Bean;

import android.view.View;

import com.example.skinmanager.Manager.SkinManager;

import java.util.List;

public class SkinView {
    List<SkinItem> skinItems;
    View view;

    public SkinView(List<SkinItem> skinItems, View view) {
        this.skinItems = skinItems;
        this.view = view;
    }
    public void apply(){
        for (SkinItem skinItem : skinItems){
            if (skinItem.getName().equals("background")){
                if (skinItem.getTypeName().equals("color")){
                    if (SkinManager.getInstance().resourceIsNull()){
                        view.setBackgroundResource(SkinManager.getInstance().getColor(skinItem.resId));
                    }else {
                        view.setBackgroundColor(SkinManager.getInstance().getColor(skinItem.resId));
                    }
                }
            }
        }
    }

    public View getView() {
        return view;
    }

    public void setView(View view) {
        this.view = view;
    }

    public List<SkinItem> getSkinItems() {
        return skinItems;
    }

    public void setSkinItems(List<SkinItem> skinItems) {
        this.skinItems = skinItems;
    }
}
